home *** CD-ROM | disk | FTP | other *** search
/ GFX Sensations 1 / Graphic Sensations - Volume 1.iso / tools / amiga / utility / dpbuddya.lha / BuddySystem / Text / HAM_Mode < prev    next >
Encoding:
Text File  |  1980-11-08  |  6.2 KB  |  123 lines

  1.                            An Explanation Of HAM
  2.  
  3.      On the Amiga and most other computers, images are defined by pixels on
  4. a screen. In the simplest display, a pixel can either be on (visible) or
  5. off (invisible). This can be compared to an LCD display on a digital watch.
  6. Computers are the same way. However with color computers like the Amiga, a
  7. little more is involved. Bit-planes are used to define multi-colored
  8. pixels.  A bit-plane is a memory area used to define the pixels of a screen
  9. display. It refers to the number of bits that are used to define a single
  10. pixel.  For instance, let's use an example of a Lo-Res 320 x 200 screen
  11. where we have an area 320 pixels wide by 200 pixels high.  Now, lets say we
  12. have a single bit-plane available to define the display.  For each pixel on
  13. the screen we have a single bit (binary digit, which can only be 1 or 0)
  14. that controls whether the pixel is on or off.  In this mode, we only have
  15. two available colors:  the color used when a pixel is off and the color
  16. used when a pixel is on.  This can be demonstrated with the following
  17. simulation of a 16 x 16 pixel screen:
  18.  
  19. 0000000000000000
  20. 0011111111111100
  21. 0100000000000010
  22. 0101110000111010
  23. 0101010000101010
  24. 0101110000111010
  25. 0100000100000010
  26. 0100000100000010
  27. 0100000100000010
  28. 0100000110000010
  29. 0101000000001010
  30. 0100100000010010
  31. 0100011111100010
  32. 0100000000000010
  33. 0011111111111100
  34. 0000000000000000
  35.  
  36. By using 0s to represent one color and 1s to represent another, you should
  37. be able to make out an image of a face.  Therefore, each pixel of a 1
  38. bit-plane image can be described as 0 or 1, for 2 possible colors.  Every
  39. additional bit-plane doubles the available number of colors. In a 2
  40. bit-plane image, each pixel can be defined as 00, 01, 10, or 11, for a
  41. total of 4 colors. Furthermore, 3 bit-planes provides the following
  42. possibilities: 000, 001, 010, 100, 101, 110, 111 or 011 for a total of 8
  43. colors. If you notice every bit plane is the equivalent of raising 2 to
  44. some power:
  45.  
  46.      1 bit-plane = 2 to the power of 1 or 2^1 =                  2 colors  
  47.      2 bit-planes:  2^2 or 2 x 2 =                               4 colors
  48.      3 bit-planes:  2^3 or 2 x 2 x 2 =                           8 colors
  49.      4 bit-planes:  2^4 or 2 x 2 x 2 x 2 =                      16 colors
  50.      5 bit-planes:  2^5 or 2 x 2 x 2 x 2 x 2 =                  32 colors
  51.  
  52. As you can see, the possible number of colors relates to your available
  53. choices of color when you load DeluxePaint.
  54.  
  55. To define actual color values, the Amiga adjusts the intensities of Red,
  56. Green and Blue used to display a pixel. The Amiga's built-in Hardware is
  57. capable of controlling 16 levels each for Red, Green or Blue. That is,
  58. 16 levels of Red, 16 levels of Green and 16 levels of Blue, for a possible
  59. total of 16 x 16 x 16 = 4096 total color possibilities.  Each display mode
  60. represents a certain number of colors OUT OF a possible 4096.  So that a 5
  61. bit-plane display allows 32 OUT OF 4096 colors.
  62.  
  63. So,  6 bit-planes should be 2^6 or 64 colors right? Well, on the Amiga
  64. this is where HAM (Hold And Modify) mode comes in.  Instead of directly
  65. accessing 64 separate colors, different calculations are used.  Actually,
  66. this HAM mode uses mathematical trickery to display 4096 colors - you don't
  67. have the same, direct access with a HAM palette as you would in a 32 color
  68. palette.  Instead, certain colors affect what adjacent colors can be.  This
  69. allows the possibility of 4096 different colors on screen at one time.
  70.  
  71. NOTE: There is a 64 color display mode, called Extra-Halfbrite Mode, but
  72.       this does not provide truly independent access to 64 separate colors.
  73.       the extra 32 are actually half-intensities of the first 32.
  74.           
  75.           SEE -> `HBrite Mode`
  76.  
  77. Here's a condensed technical description of HAM mode.
  78.  
  79.      Instead of using 6 bits to directly define 64 colors HAM mode does the
  80.      following calculations:
  81.  
  82.      If the first 2 bits are "00", the remaining 4 bits (which give a range
  83.      from 0 to 15 for a total of 16 possibilities) are used to look up the
  84.      pixel's color in the color table.  This gives 16 definite values from
  85.      a possible 4096 colors available (which is why DPaint only cycles
  86.      the first 16 colors in HAM mode; all other colors are calculated from
  87.      the first 16) in the Color Palette.  Each color has 4 bits or 16
  88.      levels each of red, green, and blue information; thus, each color has
  89.      a Red value from 0 to 15, a Green value from 0 to 15, and a Blue value
  90.      from 0 to 15.  Again, since each color is defined by a combination of
  91.      RGB, there are 16 x 16 x 16, or 4096 possible colors.
  92.  
  93.      If the first 2 bits of a given pixel are "01", the pixel has the same
  94.      color as the pixel to its immediate left, except that the last four
  95.      bits can be used to replace the Red value of that pixel.  If the first
  96.      2 bits are "10", the last four bits replace the green value, and if
  97.      the first two bits are "11", the last four bits replace the blue
  98.      value. This is why the term "Hold and Modify" is used; two of the
  99.      three values used to define a pixel are held, while the other is
  100.      modified.
  101.  
  102.      The effect of all this is that you can display all 4096 colors on the
  103.      screen at one time, although you can't go from black (R0,G0,B0) to
  104.      white (R15,G15,B15) in one pixel; it takes a total of three pixels to
  105.      allow you to make that transition since you can only modify one of the
  106.      RGB values for each pixel.  The transition would take four pixels on
  107.      the screen with the first pixel being R0,G0,B0; the second pixel being
  108.      R15,G0,B0; the third pixel being R15,G15,B0; and the fourth pixel
  109.      being R15,G15,B15 (white). 
  110.  
  111.      This limitation can cause some unexpected results. Certain colored
  112.      pixels placed next to others can modify or become modified by other
  113.      pixels.  This is due to the way HAM must modify certain colors as
  114.      mentioned previously. The result can be color fringing along certain
  115.      color borders or edges. DPaint uses special routines to minimize this
  116.      problem, but sometimes color fringing is unavoidable. 
  117.  
  118.      Remember, that the first 16 colors are directly defined colors and 
  119.      are not defined by the HAM process. This means that those 16 can be
  120.      used anywhere on the screen and won't affect or be affected by other
  121.      colors.
  122.  
  123.